package com.ylbh.modules.storereturn.controller;

import com.ylbh.common.pojo.storereturn.dto.StoreReturnDTO;
import com.ylbh.common.pojo.storereturn.vo.StoreReturnVO;
import com.ylbh.common.utils.CommonResult;
import com.ylbh.common.utils.PageUtils;
import com.ylbh.common.utils.Ref;
import com.ylbh.modules.storereturn.service.ShoppingStoreReturnService;
import io.swagger.annotations.ApiOperation;
import org.apache.shiro.authz.annotation.RequiresPermissions;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
@RequestMapping("business")
public class ShoppingStoreReturnController {

    @Autowired
    private ShoppingStoreReturnService shoppingStoreReturnService;

    @ApiOperation("联盟店退换货列表")
    @RequiresPermissions("business:queryStoreReturnList")
    @RequestMapping("queryStoreReturnList")
    public CommonResult<PageUtils> queryStoreReturnList(StoreReturnDTO dto) {
        PageUtils list = shoppingStoreReturnService.queryStoreReturnList(dto);
        return Ref.ok(list);
    }

    @ApiOperation("联盟店退换货详情")
    @RequiresPermissions("business:getStoreReturnById")
    @RequestMapping("getStoreReturnById/{returnId}")
    public CommonResult<StoreReturnVO> getStoreReturnById(@PathVariable String returnId) {
        StoreReturnVO vo = shoppingStoreReturnService.getStoreReturnById(returnId);
        return Ref.ok(vo);
    }
}
